<?php


/*
 * Created on 27.08.2009
 *
 * by MasterGenny
 */

/**
* Value object of team with all attributes in one object 
*/
class GameVO {

	public $id;

	public $spielnummer;

	public $saison;

	public $tag;

	public $datum;

	public $uhrzeit;

	public $heim;

	public $gast;

	public $pHeim;

	public $pGast;

	public $teamId;

	public function __construct($id = 0) {
		$this->id = $id;
		$this->spielnummer = 'XX';
		$this->saison = 0;
		$this->tag = 'X';		
		$this->datum = 'dd.mm.YY';
		$this->uhrzeit = 'HH:MM';
		$this->heim = 'heim';
		$this->gast = 'gast';
		$this->pHeim = 0;
		$this->pGast = 0;
		$this->teamId = 0;
	}

	public function __get($pMemberName) {
		$member = $pMemberName;
		if (!isset ($this-> $member)) {
			throw new UnknownMemberException(__CLASS__, $pMemberName);
		} else {
			return $this-> $member;
		}
	}

	public function __set($pMemberName, $pValue) {
		$member = $pMemberName;
		if (!isset ($this-> $member)) {
			throw new UnknownMemberException(__CLASS__, $pMemberName);
		} else {
			$this-> $member = $pValue;
		}
	}
	
	public function show() {
		$members = get_object_vars($this);
		echo "Game: ";
		foreach ($members as $key => $value) {
			printf("%s= %s ", $key, $value);
		}
		echo "<br/>";
	}
	
	public function getGameInfo() {
		$game .= $this->spielnummer . " - ";
		$game .= date("d.m.Y", strtotime($this->datum)) . " - ";
		$game .= $this->heim." : ".$this->gast . " - ";		
		$game .= $this->pHeim." : ".$this->pGast;		
		return $game;
	}

	public function getObjectVars() {
		return get_object_vars($this);
	}
}
?>
